# Makefile for the GRO_Gui library

include Makefile.conf

CFLAGS += $(GRO_CFLAGS) -fPIC -DTIXML_USE_STL -std=c++0x
LIBS = $(GRO_LIBS)

GRO_VER = 0
GRO_VER_MINOR = 2
GRO_VER_BUGFIX = 0

FILES = GRO_Beacons.cpp GRO_Button.cpp GRO_Checkbox.cpp GRO_Font.cpp GRO_Group.cpp GRO_Gui.cpp GRO_Input.cpp GRO_Painter.cpp GRO_Panel.cpp GRO_Spinner.cpp GRO_Text.cpp GRO_utility.cpp tinystr.cpp tinyxml.cpp tinyxmlerror.cpp tinyxmlparser.cpp

BASENAMES = $(basename $(FILES))

OBJECTS = $(addsuffix .o, $(BASENAMES))



# Making the full library
all:	version $(OBJECTS)
	@ar rsc libgro_gui.a $(OBJECTS)
	@echo
	@echo ~~ Ready!  Type \'make install\' or \'sudo make install\' to install to $(PREFIX)/lib and $(PREFIX_H) ~~

$(OBJECTS): %.o:%.cpp
	$(CXX) $(CFLAGS) -c $<

shared: all
	$(CXX) $(CFLAGS) -Wl,-soname,libgro_gui.so.$(GRO_VER) -fpic -fPIC -shared -o libgro_gui.so $(OBJECTS) $(LIBS)

shared-strip:	shared
	@strip libgro_gui.so

# Building a dll... Is this right?
dll:	config $(OBJECTS)
	dlltool --output-def gro_gui.def $(OBJECTS)
	dllwrap --driver-name $(CXX) -o gro_gui.dll --def gro_gui.def --output-lib libgro_gui.a --dllname gro_gui.dll $(OBJECTS) $(LIBS)

dll-strip:	dll
	@strip gro_gui.dll

clean:
	@rm -f *.o *.so *.a *.dll *.def

version:

ifneq ($(QUIET),y)
	@echo "~~ Making GRO_Gui v$(GRO_VER).$(GRO_VER_MINOR).$(GRO_VER_BUGFIX) ~~"
	@echo
endif

install:	shared
	@mkdir -p $(PREFIX_H)
	@echo Installing GRO_Beacons.h...
	@install -c -m 644 GRO_Beacons.h $(PREFIX_H)
	@echo Installing GRO_Button.h...
	@install -c -m 644 GRO_Button.h $(PREFIX_H)
	@echo Installing GRO_Checkbox.h...
	@install -c -m 644 GRO_Checkbox.h $(PREFIX_H)
	@echo Installing GRO_Font.h...
	@install -c -m 644 GRO_Font.h $(PREFIX_H)
	@echo Installing GRO_Group.h...
	@install -c -m 644 GRO_Group.h $(PREFIX_H)
	@echo Installing GRO_Gui.h...
	@install -c -m 644 GRO_Gui.h $(PREFIX_H)
	@echo Installing GRO_Input.h...
	@install -c -m 644 GRO_Input.h $(PREFIX_H)
	@echo Installing GRO_Painter.h...
	@install -c -m 644 GRO_Painter.h $(PREFIX_H)
	@echo Installing GRO_Panel.h...
	@install -c -m 644 GRO_Panel.h $(PREFIX_H)
	@echo Installing GRO_Renderer.h...
	@install -c -m 644 GRO_Renderer.h $(PREFIX_H)
	@echo Installing GRO_Spinner.h...
	@install -c -m 644 GRO_Spinner.h $(PREFIX_H)
	@echo Installing GRO_Text.h...
	@install -c -m 644 GRO_Text.h $(PREFIX_H)
	@echo Installing tinystr.h...
	@install -c -m 644 tinystr.h $(PREFIX_H)
	@echo Installing tinyxml.h...
	@install -c -m 644 tinyxml.h $(PREFIX_H)

	@mkdir -p $(PREFIX)/lib
	@echo Installing libgro_gui.a...
	@install -c -m 644 libgro_gui.a $(PREFIX)/lib
	@echo Installing libgro_gui.so.$(GRO_VER).$(GRO_VER_MINOR).$(GRO_VER_BUGFIX)
	@install -c libgro_gui.so $(PREFIX)/lib/libgro_gui.so.$(GRO_VER).$(GRO_VER_MINOR).$(GRO_VER_BUGFIX)
	@echo Creating extra links, libgro_gui.so and libgro_gui.so.$(GRO_VER)
	@cd $(PREFIX)/lib;\
	ln -sf libgro_gui.so.$(GRO_VER).$(GRO_VER_MINOR).$(GRO_VER_BUGFIX) libgro_gui.so.$(GRO_VER);\
	ln -sf libgro_gui.so.$(GRO_VER) libgro_gui.so;
	@echo
	@echo "** Header files installed in $(PREFIX_H)"
	@echo "** Library files installed in $(PREFIX)/lib"
	@echo "Note: Specific Renderers and Fonts should be made part of your project."

